package com.gobrs.async.core;

import com.gobrs.async.core.common.domain.TaskResult;
import com.gobrs.async.core.log.LogWrapper;
import lombok.Data;
import lombok.experimental.Accessors;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutorService;

/**
 * 任务总线
 * 封装流程中重要的配置信息和任务执行过程中的流转信息
 */
@Data
@Accessors(chain = true)
public class TaskSupport {

    /**
     * 任务加载器
     */
    public TaskLoader taskLoader;

    /**
     * 规则名称
     */
    private String ruleName;

    /**
     * 执行线程池
     */
    public ExecutorService executorService;

    /**
     * 日志封装
     */
    private volatile LogWrapper logWrapper;

    /**
     * 任务参数封装
     */
    private Object param;

    /**
     * 任务结果
     */
    private Map<Class, TaskResult> resultMap = new ConcurrentHashMap<>();

}
